#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=13;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
int maxProduct(string s) {
    int n=s.length();
    int s1=1<<n;
    int s2=s1;
    int ans=1;
    for(int i=1;i<s1;++i)
    {
        string t1="";
        for(int k=0;k<n;k++)
        {
            if( (i>>k)&1 )
            {
                t1+=s[k];
            }
        }
        int l=0;int r=(int)t1.size()-1;
        bool flag1=true;
        while(l<r)
        {
            if(t1[l]!=t1[r])
            {
                    flag1=false;
                    break;
            }
            l++;r--;
        }
        if(!flag1) continue;

        for(int j=1;j<s2;++j)
        {
            if((i&j)!=0) continue;
            string t2="";

            for(int k=0;k<n;k++)
            {
                if( (j>>k)&1 )
                {
                    t2+=s[k];
                }
            }

            l=0;r=(int)t2.size()-1;
            bool flag2=true;
            while(l<r)
            {
                if(t2[l]!=t2[r])
                {
                    flag2=false;
                    break;
                }
                l++;r--;
            }

            if(flag1&&flag2)
            {
                ans=max(ans,(int)t1.size()*(int)t2.size());
            }
        }
    }
    return ans;
}
int main(void){
    string s;cin>>s;
    cout<<maxProduct(s)<<endl;
   	return 0;
}
